package ioperation;

import Book.Book;
import Book.BookShelf;

import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work(BookShelf bookShelf) {
        System.out.println("#########查找图书#########");
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入要查找的图书：");
        String name=scanner.nextLine();
        int currentSize= bookShelf.getUsedSize();
        for (int i = 0; i < currentSize; i++) {
            Book book=bookShelf.getBooks(i);
            if(book.getName().equals(name)){
                System.out.println("找到了！！！！");
                System.out.println(book);
                return;
            }
        }
        System.out.println("找不到啊，没有你要的书呢亲亲！！！！！！！！！！");


    }
}
